#coding=utf-8


from flask import Flask
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy

from settings import config

bootstrap = Bootstrap()

db = SQLAlchemy()

def create_app(config_name):
    app = Flask(__name__)


    app.config.from_object(config[config_name])
    config[config_name].init_app(app)



    bootstrap.init_app(app)
    db.init_app(app)

    from .blue_recover import blue_recover
    app.register_blueprint(blue_recover)

    from .blue_auth import blue_auth
    app.register_blueprint(blue_auth)

    from .blue_api import blue_api
    app.register_blueprint(blue_api,url_prefix='/api')
    return app